"use strict";

const path = require("path");
const fs = require("fs");

const appDir = fs.realpathSync(process.cwd()); //项目的绝对路径
const publicUrl = process.env.PUBLIC_URL; //应用的公共URL，例如http://tanguangming.cn/project1

const getAbsPathRelatedToAppDir = relativePath =>
	path.resolve(appDir, relativePath);

module.exports = {
	envConfig: getAbsPathRelatedToAppDir(".env"),
	appPath: getAbsPathRelatedToAppDir("."),
	appPackegejson: getAbsPathRelatedToAppDir("package.json"),
	appNodeModules: getAbsPathRelatedToAppDir("node_modules"),
	appSrc: getAbsPathRelatedToAppDir("src"),
	publicUrl,
	getAbsPathRelatedToAppDir
};
